package com.lxw.hi_mvp_mvvm.scene2_mvvm;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.lxw.hi_mvp_mvvm.R;
import com.lxw.hi_mvp_mvvm.databinding.ActivityScene2Binding;

/**
 * @authour
 * @function
 * @date 2021/4/16
 */
public class Scene2Activity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityScene2Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_scene2);

        HomeViewModel model = new HomeViewModel();
        binding.setViewModel(model);

        model.getUserInfo();

        binding.edit.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                Log.e("TAG", model.userFiled.get().address);
            }
        });
    }
}
